/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package treeship.core.service.impl;

import treeship.core.service.DimensionalFactory;
import treeship.core.ship.space.Position;
import treeship.core.ship.space.Shape;
import treeship.core.ship.space.impl.Position2D;
import treeship.core.ship.space.impl.SquareShape2D;

/**
 *
 * @author Moonchild
 */
public class DimensionalFactorySquare2D extends DimensionalFactory {

    @Override
    public Position createPositionFromSeed(Long shipSeed, Long staticPositionSeed, Shape owner, Shape inner) {
        SquareShape2D owner2D = (SquareShape2D) owner;
        SquareShape2D inner2D = (SquareShape2D) inner;
        double x = (owner2D.getWidth() - inner2D.getWidth()) * seedsTo01Double(shipSeed, staticPositionSeed);
        double y = (owner2D.getHeight() - inner2D.getHeight()) * seedsTo01Double(shipSeed, staticPositionSeed + 1);
        return new Position2D(x, y);

    }

    @Override
    public Shape createNewShape() {
        return new SquareShape2D();
    }
}
